home *** CD-ROM | disk | FTP | other *** search
/ MacWarehouse Macintosh Games / MacWarehouse Macintosh Games.iso / AMBER demo / ROXY / ROXY.dxr / 00457.ls < prev    next >
Encoding:
Text File  |  1996-10-18  |  3.2 KB  |  118 lines

  1. on returnToSlideshow
  2.   global oStoryteller, gSavedOffice, gAmberPath, colorcrsr, domainIsReady
  3.   set startingLocation to getState(oStoryteller, #currentLocation)
  4.   put startingLocation
  5.   if startingLocation = #OfficeExit then
  6.     put "yes, it was #OfficeExit"
  7.     setProp(the lsStateData of oStoryteller, #currentLocation, [#OfficeEntry2])
  8.   else
  9.     put "no, it wasn't #OfficeExit"
  10.   end if
  11.   goTo(#Office_Tunnel_OUT, #forward)
  12.   set domainIsReady to 0
  13.   cursorOff()
  14.   if objectp(colorcrsr) then
  15.     colorcrsr(mReleaseCursor)
  16.     colorcrsr(mdispose)
  17.     set colorcrsr to #comingBack
  18.     cursor(0)
  19.     cursor(4)
  20.   end if
  21.   go("reviews", gAmberPath & "AMBERHUB")
  22. end
  23.  
  24. on startMovie
  25.   global colorcrsr, gGammaLevel
  26.   if objectp(colorcrsr) then
  27.     colorcrsr(mReleaseCursor)
  28.     colorcrsr(mdispose)
  29.     set colorcrsr to #comingBack
  30.   end if
  31.   cursor(0)
  32.   cursor(4)
  33.   checkForPatches()
  34.   if gGammaLevel = "unknown" then
  35.     stripMenu()
  36.   end if
  37. end
  38.  
  39. on stripMenu
  40.   set cNum to 14
  41.   installMenu(0)
  42.   set totalLines to the number of lines in field cNum
  43.   set targetLine to 0
  44.   repeat with i = 1 to totalLines
  45.     if line i of field cNum contains "Brightness" then
  46.       set targetLine to i
  47.       exit repeat
  48.     end if
  49.   end repeat
  50.   if targetLine = 0 then
  51.     put "<!>  Can't trim menu twice!"
  52.     exit
  53.   end if
  54.   delete line targetLine of field cNum
  55.   repeat while line targetLine of field cNum <> EMPTY
  56.     if line targetLine of field cNum contains "menu:" then
  57.       exit repeat
  58.     end if
  59.     delete line targetLine of field cNum
  60.   end repeat
  61. end
  62.  
  63. on checkForPatches
  64.   global oPatchManager
  65.   if objectp(oPatchManager) then
  66.     patchMe(oPatchManager, the movieName)
  67.   end if
  68. end
  69.  
  70. on closePatchFile
  71.   global oPatchManager
  72.   if objectp(oPatchManager) then
  73.     closePatchFile(oPatchManager)
  74.   end if
  75. end
  76.  
  77. on setGammaLevel desiredLevel
  78.   global gCurrentGamma, gGammaLevel
  79.   set currentLevel to gGammaLevel
  80.   set lsSettings to [:]
  81.   repeat with pNum = 1 to 7
  82.     addProp(lsSettings, pNum, gCurrentGamma - float((pNum - gGammaLevel) * 0.10000000000000001))
  83.   end repeat
  84.   set newGamma to getaProp(lsSettings, desiredLevel)
  85.   if voidp(newGamma) then
  86.     put "<!>  Sorry, " & desiredLevel & " is not an acceptable value for desired level (try 1 - 7)"
  87.     exit
  88.   end if
  89.   setGammaTable(newGamma)
  90.   set gCurrentGamma to newGamma
  91.   repeat with i = 1 to 7
  92.     set the checkMark of menuItem i of menu 4 to 0
  93.   end repeat
  94.   set the checkMark of menuItem (8 - desiredLevel) of menu 4 to 1
  95.   set gGammaLevel to desiredLevel
  96. end
  97.  
  98. on setGammaTable gammaSetting
  99.   global oGamma, gMainScreen, gGammaSize, gGammaLevel
  100.   if gammaSetting < 0.10000000000000001 then
  101.     put "<i>  Sorry, " & gammaSetting & " is not a good value; resetting it to 0.1.."
  102.     set gammaSetting to 0.10000000000000001
  103.   end if
  104.   set howManyChannels to gGammaSize / 256
  105.   set highGamma to oGamma(mReadGammaTable, gMainScreen, gGammaSize)
  106.   set xMultiplier to float(highGamma / 255.0)
  107.   set newTable to []
  108.   repeat with cNum = 1 to howManyChannels
  109.     repeat with x = 0 to 255
  110.       set y to highGamma * power(x * xMultiplier / float(highGamma), gammaSetting)
  111.       append(newTable, integer(y))
  112.     end repeat
  113.   end repeat
  114.   repeat with entryNum = 1 to 256 * howManyChannels
  115.     oGamma(mWriteGammaTable, gMainScreen, entryNum, getAt(newTable, entryNum))
  116.   end repeat
  117. end
  118.